import React from 'react';
import { Icon } from 'antd';
import {WeaCheckbox} from 'ecCom';
import '../../../style/goal/goalDetaillTop.less';


export default class GoalDetailTop extends React.Component{
    constructor(props){
        super(props)
        this.state = {
            isShow:true,
        }
    }

    render(){
        const {username,createdate,createtime,detailkey,openType} = this.props;
        if(openType == '1'){
            return(
                <div className = "goal-title-div">
                    <div className = "goal-title-div-left">
                        <i className="icon-coms-Collection"/>
                        <span className="goal-title-name">{username+" "+createdate+" "+createtime}</span>
                    </div>    
                    
                    <div className = "goal-title-div-right">
                        <div className = "goal-title-select"> 
                            <WeaCheckbox
                                className = "goal-title-checkbox"
                                id='test'
                                onChange={(value) => this.complete(detailkey,"status",value == '0' ? 1 : 2,'int')}
                                value = {status == "2" ? 1 : 0}  
                            />

                            <span className="">标记已完成</span>
                        </div>
                        <div className = "goal-title-icon">
                            <i className="icon-portal-content-o" onClick={() => console.log("反馈")} />
                            <i className="icon-coms-delete" onClick={() => this.delete(key)}/>
                            <span className="rodal-close" onClick={() => this.inputChange("status",'3','int')}></span>
                        </div>
                    </div>
                </div>
            )
        }else{
            return (
                <div></div>
            )
        }

    }
    //完成
    complete = (id,name,value,type) =>{
        if(typeof this.props.complete === "function"){
            this.props.complete(id,name,value,type);;
        }
    }

    //删除
    delete = (id) =>{
        if(typeof this.props.delete === "function"){
            this.props.delete(id);;
        }else{
            console.log(id);
        }
    }

    //撤销
    revoke = (id) =>{
        if(typeof this.props.revoke === "function"){
            this.props.revoke(id);;
        }else{
            console.log(id);
        }
    }


}